package com.service.tag.impl;

import com.bean.Tag;
import com.dao.TagMapper;
import com.service.core.AbstractService;
import com.service.tag.TagService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;

/**
 * Created by lvjianqing on 2017/9/12.
 */
@Service
public class TagServiceImpl extends AbstractService<Tag, Integer> implements TagService {
    @Autowired
    private TagMapper tagMapper;

    @Override
    public List<Tag> findByLv(Integer lv,String name) {
        HashMap<String, Object> map = new HashMap<>();
        map.put("lv", lv);
        map.put("lv1", lv-1);
        map.put("name", name);
        return tagMapper.findAll(map);
    }

    @Override
    public List<Tag> findByParentId(Integer pid) {
        return tagMapper.findByParentId(pid);
    }
}
